{{ $link := .Get 0 }}
{{ if not $link }}
  {{ errorf "No page title specified" }}
{{ end }}

{{ $hash := .Get 1 }}

{{/* Try both with and without leading slash for compatibility */}}
{{ $page := "" }}
{{ if hasPrefix $link "/" }}
  {{ $page = site.GetPage (strings.TrimPrefix "/" $link) }}
{{ else }}
  {{ $page = site.GetPage $link }}
{{ end }}

{{ if not $page }}
  {{ errorf "Error in jump shortcode at %s: No page found at %s. Please ensure the page exists and the path is correct." $.Page.File.Path $link }}
{{ end }}

<div class="jump">
  <a href="{{ $link }}{{ with $hash }}#{{ . }}{{ end }}">
    <div class="border dark:border-gray-700 rounded-md px-3.5 py-2 hover:border-secondary dark:hover:border-primary">
      <div class="flex justify-between items-center">
        <span class="dark:text-gray-300 text-gray-700 tracking-tight text-base">
          {{ $page.Title }}
        </span>

        {{/* Heroicon: outline/chevron-right */}}
        <svg xmlns="http://www.w3.org/2000/svg" class="text-secondary dark:text-primary h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
        </svg>
      </div>
    </div>
  </a>
</div>